set proc to sospro
set proc to boxproc
dr='q:'
f1='revenue2'
f11='revemp2'
sele 1
set exclu off
use &dr&f1 inde &dr&f11
go top
SET DEVI TO PRINT
@ 0, 1 SAY CMONTH(DATE()-25)+' '+STR(YEAR(DATE()-25))
@ 0, 1 SAY '                          E M P L O Y E E   P A T I E N T'
@ 2, 1 say 'PATIENT  PATIENT NAME                   TOTAL       TOTAL       TOTAL   TOTAL'
@ 3, 1 SAY ' CODE                               PROCEDURE    PHARMACY         FEE   VISIT'
@ 4, 1 SAY '============================================================================='
BR=5
Gtotproc=0
Gtotphar=0
Gtotfee=0
GTOTVIS=0
do while .not. eof()
   codtyp=pat_codtyp
   if codtyp<>'9' .and. codtyp<>'0'
      skip
      loop
   endif
   patkod=pat_filcod
   patnam=pat_name
   patfnam=pat_f_name
   totproc=0
   totphar=0
   totfee=0
   TOTVIS=0
   do while patkod=pat_filcod .and. .not. eof()
      if codtyp<>'9'.and. codtyp<>'0'
         skip
         loop
      endif
      totproc=totproc+total_proc
      totphar=totphar+total_phar
      totfee =totfee +total_fee
      TOTVIS=TOTVIS+1
      Gtotproc=Gtotproc+total_proc
      Gtotphar=Gtotphar+total_phar
      Gtotfee =Gtotfee +total_fee
      GTOTVIS=GTOTVIS+1
      skip
   enddo
   @ br,2 say patkod
   @ br,10 say alltrim(patnam)+' '+alltrim(patfnam)
   DO SAYG WITH BR,36,TOTPROC,'999,999.99','99,999,999'
   DO SAYG WITH BR,48,TOTPHAR,'999,999.99','99,999,999'
   DO SAYG WITH BR,60,TOTFEE,'999,999.99','99,999,99'
*   @ br,36 say totproc pict '99,999,999'
*   @ br,48 say totphar pict '99,999,999'
*   @ br,60 say totfee pict '99,999,999'
   @ BR,75 SAY TOTVIS PICT '999'
   br=br+1
   if br=56
      @ 0, 1 SAY CMONTH(DATE()-25)+' '+STR(YEAR(DATE()-25))
      @ 0, 1 SAY '                          E M P L O Y E E   P A T I E N T'
      @ 2, 1 say 'PATIENT  PATIENT NAME                   TOTAL       TOTAL       TOTAL   TOTAL'
      @ 3, 1 SAY ' CODE                               PROCEDURE    PHARMACY         FEE   VISIT'
      @ 4, 1 SAY '============================================================================='
      BR=5
   ENDIF
enddo
BR=BR+1
DO SAYG WITH BR,36,GTOTPROC,'999,999.99','99,999,999'
DO SAYG WITH BR,48,GTOTPHAR,'999,999.99','99,999,999'
DO SAYG WITH BR,60,GTOTFEE,'999,999.99','99,999,999'
*@ br,36 say Gtotproc pict '99,999,999'
*@ br,48 say Gtotphar pict '99,999,999'
*@ br,60 say Gtotfee pict '99,999,999'
@ BR,75 SAY GTOTVIS PICT '999'

CLOS ALL
SET DEVI TO SCREEN

